package ExamSystemClient.managerSystem.ExamManagement;

import ExamSystemClient.model.ChoiceQuestion;

import java.util.List;

/**
 * 考题管理抽象类
 */
public abstract class QuestionManage {
    List<ChoiceQuestion> questions;

    public QuestionManage(List<ChoiceQuestion> questions) {
        this.questions = questions;
    }

    /**
     * 信息管理抽象方法
     */
    public abstract void operate();

    /**
     * 打印操作信息
     */
    public abstract QuestionManage show();

    /**
     * 根据学号获得对应信息索引
     * @param number
     * @return
     */
    public int getIndexByNumber(int number){
        int index = -1;
        for (ChoiceQuestion question : questions) {
            if (question.getNumber() == number){
                index = questions.indexOf(question);
                break;
            }
        }
        return index;
    }

}
